<script src="{{ getAssets }}js/amazeui.datatables.min.js?v={{ assets_version }}"></script>
<script>
var entry_id = '{{.m.Id}}';
var tables = $('#dataTables').DataTable({
    "sAjaxSource" : '{{ urlfor "EntryreturnController.EntryreturnData"}}'
    ,"bLengthChange": false
    ,"fnServerData" : function(sSource, aoData, fnCallback) {
        var params = checkQueryTableData(aoData);
        params.entry_id = Number(entry_id);
        $.post(sSource, params,function(resp) {
            fnCallback(resp);
        },'json');
    }
    ,order:[]
    ,columns: [
        {"bSortable": false, render:function(data, type, full, meta) {
                return '<div align="left" style="padding-left:3px"><input type="checkbox" class="selectOne" value="'+ meta.row +'"></div>';
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return productGroupName(full.Products);
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.sph;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.cyl;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.add;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.model;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.color;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.size;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.function_info;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.film_color;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Snd.genre;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Products.Spec;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Acceptance.lot_number;
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Acceptance.manufacture_date > 0 ? timetransDate(full.Acceptance.manufacture_date) : '';
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return full.Acceptance.expiry_date > 0 ? timetransDate(full.Acceptance.expiry_date) : '';
            }}
        ,{"bSortable": false, render:function(data, type, full, meta) {
                return '<input type="hidden" id="o-purchase-'+ full.Id +'" value="'+ full.purchase_num +'">' + full.purchase_num;
            }}
    ]
    ,"aLengthMenu":[20, 50, 100, 200]
	,'bLengthChange': true
    ,"serverSide": true
    ,"bPaginate" : false
    ,"bFilter" : false	//是否启动过滤、搜索功能
    ,"bInfo" : false //是否显示页脚信息，DataTables插件左下角显示记录数
    ,"bProcessing" : true //DataTables载入数据时，是否显示‘进度’提示
    ,"drawCallback": function(settings){
    }
});
$('#yesBtn').click(function(){
    $.post('{{ urlfor "EntryreturnController.ViewOut"}}/'+entry_id, function(res){
          if(res.code == 0) {
              layer.alert("出库出功", function(){
                  history.go(-1);
              });
              return false;
          } else {
              layer.alert(res.msg);
              return false;
          }
    }, 'json');
});
</script>